import 'package:flutter/material.dart';

class BgBarView extends StatefulWidget {
  Widget child;
  String barTag;
  bool showLine;
  BgBarView({super.key, this.showLine = true, required this.barTag, required this.child});

  @override
  State<BgBarView> createState() => _BgBarViewState();
}

class _BgBarViewState extends State<BgBarView> {
  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.transparent,
        child: Stack(
          children: [
            ///右边图片
            Positioned(
                top: 0,
                bottom: 0,
                right: 0,
                width: 20,
                child: Image.asset(
                  widget.barTag,
                  alignment: Alignment.centerRight,
                )),

            ///content
            Positioned(left: 0, bottom: 2 + 1, right: 21, top: 2, child: widget.child),

            ///下划线
            Positioned(
                left: 0,
                bottom: 0,
                right: 0,
                height: 0.5,
                child: Container(color: widget.showLine ? Colors.white : Colors.transparent)),
          ],
        ));
  }
}
